<style>
.spanlevel {
  font-size: 22px;
  font-weight: bold;
  color: black;
  padding: 10px;
}

.spanblod {
  font-weight: bold;
  color: black;
}

.checklevel {
  padding-right: 50px;
  zoom: 1.2;
}

.divtablemain {
  width: 100%;
  color: black;
  max-width: 980px;
}

.tablemain {
  width: 100%;
  border-collapse: collapse;
}

.tablemain td {
  line-height: 40px;
  min-width: 80px;
  height: 50px;
  color: black;
  text-align: center;
  border: 1px solid black;
}

.tdimg {
  width: 240px;
  height: auto;
  cursor: pointer;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table td {
  min-width: 80px;
  text-align: center;
  border: 1px solid #e8eaec;
}

.tableleft {
  text-align: left !important;
  padding: 10px;
  line-height: 24px;
}

.padding-10 {
  padding: 10px;
}

.imgmemo {
  width: 100%;
}

.imgperson {
  height: auto;
  width: 160px;
  margin: 5px;
  cursor: pointer;
}

.div-img {
  border: 1px solid #e8eaec;
  margin-right: 10px;
  cursor: pointer;
}

.signimg {
  width: 100px;
  border: 0;
}
</style>
<template>
  <div>
    <Card title="评估报告">
      <a href="#" slot="extra" @click.prevent="PrintReport">打印</a>
      <Row>
        <Center style="color:black">
          <h2>身体能力等级评估报告书</h2>
          <h3>The physical ability rating report<span style="margin-left:10px">评估人：{{ assessinfo.sys_CreaterName
              }}</span>
          </h3>
        </Center>
      </Row>
      <Row>
        <Center>
          <div class="divtablemain">
            <table border="1" cellspacing="0" cellpadding="0" class="tablemain">
              <tr>
                <td style="width: 130px;" rowspan="5">
                  评估对象
                  <br />基本信息
                </td>
                <td>姓名</td>
                <td>{{ assessperson.Name }} {{ assessperson.IsNew == 1 ? "（新）" : "" }}</td>
                <td>性别</td>
                <td>{{ assessperson.Sex }}</td>
                <td rowspan="4" style="width:180px;">
                  <viewer :images="assessinfo.PersonImg">
                    <img :src="assessinfo.PersonImg" class="imgperson" />
                  </viewer>
                </td>
              </tr>
              <tr>
                <td>出生日期</td>
                <td>{{ assessperson.Birthday }}</td>
                <td>年龄</td>
                <td>{{ assessperson.Age }}</td>
              </tr>
              <tr>
                <td>供养方式</td>
                <td>{{ assessperson.SupportType == 1 ? '集中' : assessperson.SupportType == 2 ? '分散' : '' }}</td>
                <td>户籍地</td>
                <td>{{ assessperson.BirthAddress }}</td>
              </tr>
              <tr>
                <td>身份证号</td>
                <td colspan="3">{{ assessperson.IdCard }}</td>
              </tr>
              <tr>
                <td>住址</td>
                <td colspan="3">{{ assessperson.Address }}</td>
              </tr>
              <tr>
                <td>身体状况</td>
                <td colspan="5" class="tableleft">
                  1.所患疾病（{{ assessinfo.Sick }}）2.残疾类型（{{ assessinfo.HandicapTypeName }} ）3.残疾等级（{{
                    assessinfo.HandicapLevel
                  }} ）
                </td>
              </tr>
              <tr>
                <td>综合评估指标</td>
                <td colspan="5" class="tableleft">
                  <div>
                    <span style="margin-right: 10mm; "> 1.自主吃饭（<span style="font-size: 20px;font-weight: bold;">{{ assessinfo.DailyFood > 0 ? '✔' : '' }}</span> ）</span>
                    <span style="margin-right: 10mm;"> 2.自主穿衣（<span style="font-size: 20px;font-weight: bold;">{{ assessinfo.DailyDress > 0 ? '✔' : '' }}</span> ）</span>
                    <span style="margin-right: 10mm;"> 3.自主上下床（<span style="font-size: 20px;font-weight: bold;">{{ assessinfo.DailyMoveBed > 0 ? '✔' : '' }}</span>）  </span>
                  </div>
                  <div>
                    <span style="margin-right: 10mm;"> 4.自主如厕（<span style="font-size: 20px;font-weight: bold;"> {{ assessinfo.DailyToilet > 0 ? '✔' : '' }}</span>）</span>
                    <span style="margin-right: 10mm;"> 5.室内自主行走（ <span style="font-size: 20px;font-weight: bold;">{{ assessinfo.DailyWalk > 0 ? '✔' : '' }} </span>）</span>
                    <span style="margin-right: 10mm;"> 6.自主洗澡（<span style="font-size: 20px;font-weight: bold;">{{ assessinfo.DailyShower > 0 ? '✔' : '' }}</span>）  </span>
                  </div>

                </td>
              </tr>
              <tr>
                <td>评估参数</td>
                <td colspan="5" class="tableleft">
                  <div>特困人员生活自理状况，6项指标全部达到的，可以视为具备生活自理能力；</div>
                  <div>有3项以下（含3项）指标不能达到的，可以视为部分丧失生活自理能力；</div>
                  <div>有4项以上（含4项）指标不能达到的，可以视为完全丧失生活自理能力</div>
                </td>
              </tr>
              <tr>
                <td>评估结论</td>
                <td colspan="5" class="tableleft">
                  <CheckboxGroup v-model="firstlevel">
                    <Checkbox label="0" onclick="return false" class="checklevel">
                      <span>自理</span>
                    </Checkbox>

                    <Checkbox label="2" onclick="return false" class="checklevel">
                      <span>半自理</span>
                    </Checkbox>

                    <Checkbox label="3" onclick="return false" class="checklevel">
                      <span>失能</span>
                    </Checkbox>
                  </CheckboxGroup>
                </td>
              </tr>

              <tr>
                <td colspan="2">评估现场影像资料</td>
                <td colspan="2">身体情况辅助证明资料</td>
                <td colspan="2">视频录像</td>
              </tr>
              <tr>
                <td colspan="2">
                  <viewer :images="img1">
                    <img :src="img1" class="tdimg" />
                  </viewer>
                </td>
                <td colspan="2" class="tdimg">
                  <viewer :images="img2">
                    <img :src="img2" class="tdimg" />
                  </viewer>
                </td>
                <td colspan="2">
                  <video v-if="assessinfo.PersonVideo" controls :src="assessinfo.PersonVideo"
                    class="video">您的浏览器不支持播放视频</video>
                </td>

              </tr>
              <tr>
                <td>最终认定结果</td>
                <td colspan="5" class="tableleft">
                  <CheckboxGroup v-model="finallevel">
                    <Checkbox label="0" onclick="return false" class="checklevel">
                      <span>自理</span>
                    </Checkbox>

                    <Checkbox label="2" onclick="return false" class="checklevel">
                      <span>半自理</span>
                    </Checkbox>

                    <Checkbox label="3" onclick="return false" class="checklevel">
                      <span>失能</span>
                    </Checkbox>
                  </CheckboxGroup>
                </td>
              </tr>
              <tr>
                <td>备注</td>
                <td colspan="5" class="tableleft">{{ assessinfo.Remark }}</td>
              </tr>
            </table>
            <Row type="flex" justify="center" align="middle" class="code-row-bg">
              <Col span="3" class="tableleft">评估员：</Col>
              <Col span="4" class="tableleft">
              <img :src="assessinfo.EmployeeName1" class="signimg" />
              </Col>
              <Col span="4" class="tableleft">
              <img :src="assessinfo.EmployeeName2" class="signimg" />
              </Col>
              <Col span="12">
              <br />临沂市慈济养老服务评估中心
              <br />
              {{ assessinfo.BusinessDate }}
              </Col>
            </Row>
            <Row class="tableleft" style="font-size:10px;font-weight:bold">
              本次评估结果最终解释权归本中心所有 ，任何单位及个人未经允许，不得复制本报告！
              <br />附：老年人身体能力等级评估表
            </Row>
          </div>
        </Center>
      </Row>
    </Card>
    <br />


    <Modal :mask-closable="false" v-model="modal2" title="查看图片" footer-hide>
      <div>
        <img :src="tmpimg" style="width:100%" />
      </div>
    </Modal>
    <iframe id="iframe-print" frameborder="0" style="display:none" scrolling="auto" :src="printSrc"></iframe>
  </div>
</template>
<script>
import "viewerjs/dist/viewer.css";
import Viewer from "v-viewer/src/component.vue";
import { printUrl } from "@/libs/util";
import { Modal } from "view-design";
import { GetAssessInfoByPersonId } from "@/api/data";
import dayjs from "dayjs";
export default {
  name: "tekun_assess_info",
  data() {
    return {
      printSrc: printUrl + "printlistreport4.html",
      modal2: false,
      tmpimg: "",
      firstlevel: [],
      lelelmemo: [],
      finallevel: [],
      assessperson: {},
      assessinfo: {},
      img1: "",
      img2: ""
    };
  },
  props: {
    id: {
      type: String,
      required: true
    }
  },
  components: {
    Viewer,
  },
  methods: {
    getinfo() {
      GetAssessInfoByPersonId(this.id).then(res => {
        const data = res.data;
        if (data.Type == 1) {
          this.assessperson = data.Data;
          if (this.assessperson.AssessInfo != null) {
            this.firstlevel = [this.assessperson.AssessInfo.FirstLevel + ""];
            this.finallevel = [this.assessperson.AssessInfo.FinalLevel + ""];
            this.lelelmemo = [this.assessperson.AssessInfo.LevelMemo + ""];
            this.assessinfo = this.assessperson.AssessInfo;
            try {
              this.assessinfo.BusinessDate = dayjs(
                this.assessinfo.BusinessDate
              ).format("YYYY年MM月DD日");

              this.assessperson.Birthday = dayjs(
                this.assessperson.Birthday
              ).format("YYYY年MM月DD日");
            } catch (ex) { }
            try {
              this.img1 = this.assessinfo.Imgs[0];
              this.img2 = this.assessinfo.Imgs[1];
            } catch (ex) { }
          }
        } else {
          this.$Modal.error({ title: "提示", content: data.Message });
        }
      });
    },
    bigimg(item) {
      this.tmpimg = item;
      this.modal2 = true;
    },
    PrintReport() {
      document
        .getElementById("iframe-print")
        .contentWindow.LoadData([this.assessperson]);
      document.getElementById("iframe-print").contentWindow.printData();
    }
  },
  created() { },
  mounted() {
    const oIframe = document.getElementById("iframe");
    this.getinfo();
  }
};
</script>
